<template>
  <div class="administer">
    <div class="administerNav">
      <backHeader></backHeader>
    </div>
    <div class="administerCont">
      <div v-show="currentTab == 1" class="html_pst">
        <el-form :inline="true" class="demo-form-inline lampData">
          <div class="lampData_top">

            <!--此处第一行 -->
            <el-form-item label="应用类型" class="witd wid150">
              <el-select v-model="request.contestTypeId" style="width:135px !important">
                <el-option label="全部" value></el-option>
                <el-option
                  v-for="item in typeList"
                  :label="item.dictCont"
                  :value="item.id"
                  :key="item.id"
                ></el-option>
              </el-select>
            </el-form-item>
            <!--"356" 洗墙 358柱子  498瓦楞 362窗框   单侧导光、双侧导光、光电玻璃、自发光线-->
           <template v-if="request.contestTypeId==356 || request.contestTypeId==358 || request.contestTypeId==498 || request.contestTypeId==362">
                            <el-form-item label="H" class="power">
                                <el-input v-model="request.h" style="width:76px "></el-input>
                            </el-form-item>
                            <el-form-item label="W" class="power">
                                <el-input v-model="request.w" style="width:76px"></el-input>
                            </el-form-item>
                            <el-form-item label="D" class="power">
                                <el-input v-model="request.lumSizeMin" style="width:76px"></el-input> ~ 
                                <el-input v-model="request.lumSizeMax" style="width:76px"></el-input>
                            </el-form-item>
                        </template>
                        <!--357 正投 -->
                        <template v-if="request.contestTypeId==357">
                            <el-form-item label="W" class="power">
                                <el-input v-model="request.w" style="width:76px"></el-input>
                            </el-form-item>
                            <el-form-item label="W1" class="power">
                                <el-input v-model="request.w1" style="width:76px"></el-input>
                            </el-form-item>
                            <el-form-item label="D" class="power">
                                <el-input v-model="request.lumSize" style="width:76px"></el-input>
                            </el-form-item>
                        </template>
                        <!--360 复合面 -->
                        <template v-if="request.contestTypeId==360">
                            <el-form-item label="H" class="power">
                                <el-input v-model="request.h" style="width:76px"></el-input>
                            </el-form-item>
                            <el-form-item label="W" class="power">
                                <el-input v-model="request.w" style="width:76px"></el-input>
                            </el-form-item>
                            <el-form-item label="W1" class="power">
                                <el-input v-model="request.w1" style="width:76px"></el-input>
                            </el-form-item>
                            <el-form-item label="W2" class="power">
                                <el-input v-model="request.w2" style="width:76px"></el-input>
                            </el-form-item>

                            <el-form-item label="D" class="power">
                                <el-input v-model="request.lumSizeMin" style="width:76px"></el-input> ~ 
                                <el-input v-model="request.lumSizeMax" style="width:76px"></el-input>
                            </el-form-item>
                        </template>
                        <!-- 361 单侧导光 805 双侧道光 806光电玻璃 466自发光线-->
                        <!-- <template v-if="request.contestTypeId==361 || request.contestTypeId==805  || request.contestTypeId==806 || request.contestTypeId==466 ">
                            <el-form-item label="H" class="power">
                                <el-input v-model="request.h"></el-input>
                            </el-form-item>
                            <el-form-item label="W" class="power">
                                <el-input v-model="request.w" style="width:100px"></el-input>
                            </el-form-item>
                        </template> -->

            <!--此处第二行 -->
            <el-form-item label="灯具类型" class="witd wid150">
              <el-select v-model="chooseLampType" multiple collapse-tags>
                <el-option
                  v-for="item in lampTypeList"
                  :key="item.id"
                  :label="item.lampName"
                  :value="item.id"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="样品编号" class="witd wid150">
              <el-input v-model="request.posCode"></el-input>
            </el-form-item>
            <el-form-item label="样品型号" class="witd wid150">
              <el-input v-model="request.lumModel"></el-input>
            </el-form-item>
            <!--此处第三行 -->
            <el-form-item label="灯具功率" class="power atuo">
              <el-input v-model="request.powerMin" style="width:76px"></el-input>
              <span class="xian">-</span>
              <el-input v-model="request.powerMax" style="width:76px"></el-input>
              <span>W</span>
            </el-form-item>
            <el-form-item label="检测类型" class="witd wid150">
                            <el-select v-model="request.dataTypeList" multiple collapse-tags>
                                <!-- <el-option label="全部" value=""></el-option> -->
                                <el-option label="典型检测" value="1"></el-option>
                                <el-option label="项目检测" value="2"></el-option>                            
                            </el-select>
            </el-form-item>
            <el-form-item label="色温色彩">
              <el-popover ref="colorFlagPopover" placement="bottom" width="124" trigger="focus" popper-class="xiala dianya">
                  <ul>
                      <li v-for="(item,index) in guangseleixingList" :key="index" @click="setColorFlagPopover(item)" v-html="item.dictCont"></li>
                  </ul>
              </el-popover>
              <el-input v-model="request.colorFlagText" placeholder="请选择" class="e4y" v-popover:colorFlagPopover></el-input>
            </el-form-item>
            <!-- <el-form-item label="灯具色温" class="power atuo">
              <el-input v-model="request.colorTempeMin"></el-input>
              <span class="xian">-</span>
              <el-input v-model="request.colorTempeMax"></el-input>
              <span>K</span>
            </el-form-item>
            <el-form-item label="检测日期" class=" shijian">
              <el-date-picker v-model="request.detectDateStart"></el-date-picker>
              <span class="xian">-</span>
              <el-date-picker v-model="request.detectDateEnd"></el-date-picker>
            </el-form-item> -->
            <el-form-item class="atuo">
              <el-button type="primary" @click="search(1)">查询</el-button>
            </el-form-item>
          </div>
        </el-form>
        <div class="roleControl roleControlTable">
          <el-table :data="tableData" border style="width: 100%" :max-height="tableHeight" >
            <el-table-column type="index" label="序号" width="50"></el-table-column>
            <el-table-column prop="list1" label="灯具图">
              <template slot-scope="scope" >
                <img :src="ImgPath+scope.row.lumImage" height="80" alt="" @click="viewPicture(ImgPath+scope.row.lumImage)">
              </template>
            </el-table-column>
            <template v-if="request.contestTypeId != 359 && request.contestTypeId != 465 && request.contestTypeId!=736">
            <el-table-column prop="list1" label="伪色图"  :key="Math.random()">
              <template slot-scope="scope" >
                <img :src="ImgPath+scope.row.pseuColor" height="80" alt="" @click="viewPicture(ImgPath+scope.row.pseuColor)">
              </template>
            </el-table-column>
            <el-table-column prop="list1" label="效果图"  :key="Math.random()">
              <template slot-scope="scope" >
                <img :src="ImgPath+scope.row.viewPhoto" height="80" alt="" @click="viewPicture(ImgPath+scope.row.viewPhoto)">
              </template>
            </el-table-column>
            </template>
            <el-table-column prop="list1" label="配光曲线图">
              <template slot-scope="scope" >
                <img :src="ImgPath+scope.row.lightIntensity" height="80" alt="" @click="viewPicture(ImgPath+scope.row.lightIntensity)">
              </template>
            </el-table-column>
            <el-table-column prop="posCode" label="样品编号" width="150"></el-table-column>
            <el-table-column prop="lumModel" label="样品型号" width="150"></el-table-column>
            <el-table-column prop="lumName" label="样品名称"  width="90"></el-table-column>
            <el-table-column prop="designCode" label="灯参编号"></el-table-column>
            <el-table-column prop="brandName" label="品牌"></el-table-column>
            <el-table-column prop="dictIdLtype" label="灯具类型"></el-table-column>
            <el-table-column prop="contestTypeStr" label="应用类型"></el-table-column>
<template v-if="request.contestTypeId != 359 && request.contestTypeId != 465 && request.contestTypeId!=736">
            <el-table-column prop="m" label="应用面尺寸(m)" width="140" :key="Math.random()">
              <template slot-scope="scope">
                <span v-show="scope.row.sH != null">H：{{scope.row.sH}}</span> &nbsp; <span v-show="scope.row.sW != null">W：{{scope.row.sW}}</span> &nbsp; <span v-show="scope.row.sW1 != null">W1：{{scope.row.sW1}} </span> &nbsp; <span v-show="scope.row.sW2 != null">W2：{{scope.row.sW2}}</span> &nbsp; <span v-show="scope.row.lumSize != null">D：{{scope.row.lumSize}}</span>
              </template>
            </el-table-column>
</template>
            <el-table-column prop="power" :sortable="true" label="功率">
              <template slot-scope="scope">
                <span v-show="scope.row.power != null">{{scope.row.power}}W</span>
              </template>
            </el-table-column>
            <el-table-column prop="colorTempe" :sortable="true" label="色温">
              <template slot-scope="scope">
                <span v-if="scope.row.colorTempe != null && scope.row.colorTempe != ''">{{scope.row.colorTempe}}
                  <span v-if="scope.row.colorTempe >= 1000">K</span>
                  <span v-else>nm</span>
                </span>
              </template>
            </el-table-column>
            <el-table-column prop="lumAngle" label=" 光束角" width="110">
              <template slot-scope="scope">
                <template v-if="scope.row.angle1 != null && scope.row.angle2 != null">{{scope.row.angle1}}° * {{scope.row.angle2}}°</template>
              </template>
            </el-table-column>
    <template v-if="request.contestTypeId == 359 || request.contestTypeId == 465 || request.contestTypeId==736">
      <template v-if="request.contestTypeId== 359">
                                    <el-table-column  prop="lightIntensity1" label="0°" :key="Math.random()">
                                        <template slot-scope="scope" >
                                        <span v-if="scope.row.lightIntensity1 > 0">{{scope.row.lightIntensity1}}cd</span>
                                        </template>
                                    </el-table-column>
                                    <el-table-column sortable prop="lightIntensity6" label="上30°" width="110" :key="Math.random()">
                                        <template slot-scope="scope" >
                                        <span v-if="scope.row.lightIntensity6 >0">{{scope.row.lightIntensity6}}cd</span>
                                        <span v-if="scope.row.lightIntensity6Max >0"> ~ {{scope.row.lightIntensity6Max}}cd</span>
                                        </template>
                                    </el-table-column>
                                    <el-table-column sortable prop="lightIntensity4" label="下60°" width="110" :key="Math.random()">
                                        <template slot-scope="scope" >
                                        <span v-if="scope.row.lightIntensity4 > 0">{{scope.row.lightIntensity4}}cd</span>
                                        </template>
                                    </el-table-column>
                                    <el-table-column sortable prop="lightIntensity5" label="左60°" width="110" :key="Math.random()">
                                        <template slot-scope="scope" >
                                        <span v-if="scope.row.lightIntensity5 > 0">{{scope.row.lightIntensity5}}cd</span>
                                        </template>
                                    </el-table-column>
                                    <el-table-column  sortable prop="lightIntensity2" label="右60°" width="110" :key="Math.random()">
                                        <template slot-scope="scope" >
                                        <span v-if="scope.row.lightIntensity2 > 0">{{scope.row.lightIntensity2}}cd</span>
                                        </template>
                                    </el-table-column>
                                </template>
                                <template v-if="request.contestTypeId == 465">
                                    <el-table-column  prop="lightIntensity1" label="0°" :key="Math.random()">
                                        <template slot-scope="scope" >
                                        <span v-if="scope.row.lightIntensity1 > 0">{{scope.row.lightIntensity1}}cd</span>
                                        </template>
                                    </el-table-column>
                                    <el-table-column sortable prop="lightIntensity8" label="上60°" width="110" :key="Math.random()">
                                        <template slot-scope="scope" >
                                        <span v-if="scope.row.lightIntensity8 > 0">{{scope.row.lightIntensity8}}cd</span>
                                        </template>
                                    </el-table-column>
                                    <el-table-column  sortable prop="lightIntensity4" label="下60°" width="110" :key="Math.random()">
                                        <template slot-scope="scope" >
                                        <span v-if="scope.row.lightIntensity4 > 0">{{scope.row.lightIntensity4}}cd</span>
                                        </template>
                                    </el-table-column>
                                    <el-table-column sortable prop="lightIntensity5" label="左60°" width="110" :key="Math.random()">
                                        <template slot-scope="scope" >
                                        <span v-if="scope.row.lightIntensity5 > 0">{{scope.row.lightIntensity5}}cd</span>
                                        </template>
                                    </el-table-column>
                                    <el-table-column  sortable prop="lightIntensity2" label="右60°" width="110" :key="Math.random()">
                                        <template slot-scope="scope" >
                                        <span v-if="scope.row.lightIntensity2 > 0">{{scope.row.lightIntensity2}}cd</span>
                                        </template>
                                    </el-table-column>
                                </template>
                                <template v-if="request.contestTypeId==736">
                                    <el-table-column  prop="lightIntensity6" label="上30°" :key="Math.random()">
                                        <template slot-scope="scope" >
                                        <span v-if="scope.row.lightIntensity6 > 0">{{scope.row.lightIntensity6}}cd</span>
                                        <span v-if="scope.row.lightIntensity6Max >0"> ~ {{scope.row.lightIntensity6Max}}cd</span>
                                        </template>
                                    </el-table-column>
                                    <el-table-column  sortable prop="lightIntensity3" label="下45°" width="110" :key="Math.random()">
                                        <template slot-scope="scope" >
                                        <span v-if="scope.row.lightIntensity3 > 0">{{scope.row.lightIntensity3}}cd</span>
                                        <span v-if="scope.row.lightIntensity3Max >0"> ~ {{scope.row.lightIntensity3Max}}cd</span>
                                        </template>
                                    </el-table-column>
                                    <el-table-column  sortable prop="lightIntensity7" label="下10°" width="110" :key="Math.random()">
                                        <template slot-scope="scope" >
                                        <span v-if="scope.row.lightIntensity7 > 0">{{scope.row.lightIntensity7}}cd</span>
                                        </template>
                                    </el-table-column>
                                    <el-table-column  sortable prop="lightIntensity9" label="下10° 左60°" width="130" :key="Math.random()">
                                        <template slot-scope="scope" >
                                        <span v-if="scope.row.lightIntensity9 > 0">{{scope.row.lightIntensity9}}cd</span>
                                        </template>
                                    </el-table-column>
                                    <el-table-column sortable prop="lightIntensity10" label="下10° 右60°" width="130" :key="Math.random()">
                                        <template slot-scope="scope" >
                                        <span v-if="scope.row.lightIntensity10 > 0">{{scope.row.lightIntensity10}}cd</span>
                                        </template>
                                    </el-table-column>
                                </template>
    </template>
    <template v-else>
            <el-table-column prop="lightnessAve" :sortable="true" label=" 平均亮度" width="110" :key="Math.random()">
              <template slot-scope="scope">
                <span v-show="scope.row.lightnessAve != null">{{scope.row.lightnessAve}}cd/㎡</span>
              </template>
            </el-table-column>
            <el-table-column prop="lightnessMax" :sortable="true" label=" 最大亮度" width="110" :key="Math.random()">
              <template slot-scope="scope">
                <span v-show="scope.row.lightnessMax != null">{{scope.row.lightnessMax}}cd/㎡</span>
              </template>
            </el-table-column>
            <el-table-column prop="lightness" :sortable="true" label=" 最小亮度" width="110" :key="Math.random()">
              <template slot-scope="scope">
                <span v-show="scope.row.lightness != null">{{scope.row.lightness}}cd/㎡</span>
              </template>
            </el-table-column>
            <el-table-column prop="evenness" :sortable="true" label="均匀度" width="110" :key="Math.random()"></el-table-column>
 </template>
            
            <el-table-column prop="detectDate" label=" 检测日期" width="100"></el-table-column>
            <el-table-column prop label=" 检测类型">
              <template slot-scope="scope">
                {{scope.row.dataType == 1 ? "典型检测" : "项目检测"}}
              </template>
            </el-table-column>
            <el-table-column label="操作" fixed="right">
              <template slot-scope="scope">
                  <div class="amend">
                    <el-button
                                size="mini"
                                class="editor table_editor "
                                @click="showPushDetail(scope.row)">发布详情</el-button>
                </div>
              </template>
            </el-table-column>
          </el-table>
          <div style="padding:10px;text-align:center">
            <el-pagination
              @size-change="handleSizeChange"
              @current-change="handleCurrentChange"
              :current-page="request.page"
              :page-sizes="[20, 50, 100, 200]"
              :page-size="request.rows"
              layout="total, sizes, prev, pager, next, jumper"
              :total="totalCount"
            ></el-pagination>
          </div>
        </div>
      </div>
      <div v-show="currentTab == 2" class="html_pst">
        <el-form :inline="true" class="demo-form-inline lampData">
          <div class="lampData_top">
            <span @click="backList()" class="backuy"><i class="el-icon-back"></i></span>
            <el-form-item label="机构名称" class="witd">
              <el-input v-model="InnerRequest.authorizedNameLike"></el-input>
            </el-form-item>
            <el-form-item>
              <el-button type="primary" @click="innerSearch(1)">查询</el-button>
            </el-form-item>
          </div>
        </el-form>
        <div class="add">
         

          <el-button type="primary" @click="savePrice()">保存价格</el-button>
          <el-button type="primary" @click="showAddModel()">新增发布单位</el-button>
           <!-- <span @click="showAddModel()">
            <i class="el-icon-circle-plus-outline"></i>新增发布单位
          </span> -->
        </div>

          <el-dialog
            title="新增发布单位"
            :visible.sync="isShowAddModel"
            width="40%"
            custom-class="addcustom" v-dialogDrag>
            <div class="addcustom_cont">
              <el-form :inline="true" class="demo-form-inline lampData">
              <div class="lampData_top">
                <el-form-item label="机构类型" class="witd">
              <el-select v-model="NoAuthRequest.supplierType">
                <el-option value="">全部</el-option>
                <el-option
                  v-for="item in jigouleixingList"
                  :label="item.dictCont"
                  :value="item.id"
                  :key="item.id"
                ></el-option>
              </el-select>
            </el-form-item>
                <el-form-item label="机构名称" class="witd witds">
                  <el-input v-model="NoAuthRequest.supplierNameLike"></el-input>
                </el-form-item>
                <el-form-item class="dewd">
                  <el-button type="primary" @click="loadNoAuthList(1)">查询</el-button>
                </el-form-item>
              </div>
            </el-form>
                <el-table  @selection-change="handleSelectionChange" :data="smallTable" border style="width:100%" :max-height="tableHeight3">
                    <el-table-column
                    type="selection"
                    width="55">
                    </el-table-column>
                    <el-table-column prop="supplierName" label="机构名称"></el-table-column>
                </el-table>
                <el-pagination
              @current-change="handleCurrentChange2"
              :current-page="NoAuthRequest.page"
              layout="total, prev, pager, next"
              :total="smallTotalCount"
            ></el-pagination>
              <span slot="footer" class="dialog-footer">
                <el-button @click="isShowAddModel = false">关 闭</el-button>
                <el-button type="primary" @click="savePush()">保存</el-button>
              </span>
            </div>
          </el-dialog>

        <div class="roleControl">
          <el-table :data="InnerDataTable" border style="width: 100%" :max-height="tableHeight1">
            <el-table-column type="index" label="序号" width="50"></el-table-column>
            <el-table-column prop="lumModel" label="样品型号" width="200"></el-table-column>
            <el-table-column prop="lumName" label="样品名称"></el-table-column>
            <el-table-column prop="lumPower" label=" 功率(W)"></el-table-column>
            <el-table-column prop="lumVoltage" label="电压"></el-table-column>
            <el-table-column prop="authorizedName" label="机构名称"></el-table-column>
            <el-table-column prop="authorizedPrice" label=" 价格">
              <template slot-scope="scope">
                <el-input v-model="scope.row.authorizedPrice" ></el-input>
              </template>
            </el-table-column>
            <el-table-column label="操作">
              <template slot-scope="scope">
                  <div class="amend">
                    <span @click="deleteInnerData(scope.row)">删除</span>
                </div>
              </template>
            </el-table-column>
          </el-table>
          <div style="padding:10px;text-align:center">
            <el-pagination
              @size-change="handleSizeChange1"
              @current-change="handleCurrentChange1"
              :current-page="InnerRequest.page"
              :page-sizes="[20, 50, 100, 200]"
              :page-size="InnerRequest.rows"
              layout="total, sizes, prev, pager, next, jumper"
              :total="InnerTotalCount"
            ></el-pagination>
          </div>
        </div>
      </div>
    </div>

       <!--查看图片 -->
    <el-dialog :visible.sync="showPic"  v-dialogDrag custom-class="dee">
      <img :src="showPicUrl" />
    </el-dialog>
  </div>
</template>
<script>
import backHeader from "@/views/common/backHeader.vue";
export default {
  data() {
    return {
      tableHeight3:200,
       tableHeight :50,
       tableHeight1 :200,
        currentTab:1,
      request: {
        colorFlagText:'',
        colorFlag:'',
        designCode:'',
        posCode:'',
        lumModel: "",
        colorTempeMin: "",
        colorTempeMax: "",
        powerMin: "",
        powerMax: "",
        detectDateStart: "",
        detectDateEnd: "",
        lampIdsStr: "",
        contestTypeId: "",
        h: "",
        w: "",
        w1: "",
        w2: "",
        lumSizeMin: "",
        lumSizeMax: "",
        page: 1,
        rows: 20,
        dataTypeStr:'',
        dataTypeList:[]
      },
      totalCount: 0,
      tableData: [],
      typeList: [],
      lampTypeList: [],
      chooseLampType: [],
      InnerDataTable:[],
      isShowAddModel:false,
      InnerTotalCount:0,
      InnerRequest:{
          page:1,
          rows:10,
          authorizedNameLike:''
      },
      InnerId:0,
      smallTable:[],
      smallTotalCount:0,
      NoAuthRequest:{
        page:1,
        rows:10,
        supplierNameLike:''
      },
      showPic:false,
      showPicUrl:'',
      guangseleixingList:[]
    };
  },
  created() {
    this.initData();
  },
  methods: {
    setColorFlagPopover(item){
      this.request.colorFlagText = this.HTMLDecode(item.dictCont)
      this.request.colorFlag = item.id
      this.$refs.colorFlagPopover.doClose()
    },
    HTMLDecode(text) { 
      var temp = document.createElement("div"); 
      temp.innerHTML = text; 
      var output = temp.innerText || temp.textContent; 
      temp = null; 
      return output; 
    },
    viewPicture(url){
      this.showPic = true
      this.showPicUrl = url
    },
    initData() {
      this.search(1);
      //加载分类信息
      let self = this;
      this.$http.get(
        "/api/dictTypeAllList",
        { indexPinyin: "yingyongchangjingleixing" },
        function(res) {
          if (res.success) {
            self.typeList = res.data;
            self.search(1);
          }
        }
      );
      //加载灯具类型
      this.$http.get("/api/lampTypes/json", {}, function(res) {
        if (res.success) {
          self.lampTypeList = res.data;
        }
      });
      //光色类型
                this.$http.get("/api/dictTypeAllList",{indexPinyin:'dengjusecaifenlei'},function(res){
                    self.guangseleixingList = res.data
                })

                this.$http.get("/api/dictTypeAllList",{indexPinyin:'jigouleixing',dictGroup:1},function(res){
                    self.jigouleixingList = res.data
                })
                
    },
    search(page) {
      let self = this;
      this.request.page = page;
      var temp = "";
      for (var i = 0; i < this.chooseLampType.length; i++) {
        temp += this.chooseLampType[i] + ",";
      }
      this.request.lampIdsStr = temp.substring(0, temp.length - 1);

      var temp1 = "";
      if(this.request.dataTypeList.length > 0){
        for (var i = 0; i < this.request.dataTypeList.length; i++) {
          temp1 += this.request.dataTypeList[i] + ",";
        }
      }
      this.request.dataTypeStr = temp1.substring(0, temp1.length - 1);

      this.$http.postObj("/api/contests/authList", this.request, function(res) {
        console.log(res);
        if (res.success) {
          self.tableData = res.data.rows;
          self.totalCount = res.data.total;
        }
      });
    },
    handleCurrentChange(page) {
      this.search(page);
    },
    handleSizeChange(pageSize) {
      this.request.rows = pageSize;
      this.search(1);
    },
    handleCurrentChange1(page) {
      this.innerSearch(page);
    },
    handleCurrentChange2(page) {
      this.loadNoAuthList(page);
    },
    handleSizeChange1(pageSize) {
      this.InnerRequest.rows = pageSize;
      this.innerSearch(1);
    },
    showPushDetail(row){
        this.currentTab = 2
        let self = this
        this.InnerId = row.id
      this.innerSearch(1)
    },
    innerSearch(page){
        let self = this
        this.InnerRequest.page = page
        this.$http.postObj("/api/contests/authorizes/pageJson/"+this.InnerId, this.InnerRequest, function(res) {
        if (res.success) {
            self.InnerDataTable = res.data.rows
            self.InnerTotalCount = res.data.total
        }
      });
    },
    showAddModel(){
        this.isShowAddModel = true
        this.NoAuthRequest.supplierNameLike= ''
        let self = this
        //分页获取未授权的供应商列表信息
        this.loadNoAuthList(1)
    },
    loadNoAuthList(page){
      this.NoAuthRequest.page = page
      let self = this
      this.$http.postObj('/api/contests/authorizes/noAuthSupplierList/'+this.InnerId,this.NoAuthRequest,function(res){
            if(res.success){
                self.smallTable = res.data.rows
                self.smallTotalCount = res.data.total
            }
        })
    },
    backList(){
        this.currentTab =1
    },
    handleSelectionChange(val) {
        this.multipleSelection = val;
    },
    deleteInnerData(row){
      console.log(row)
      this.$confirm('您确定要删除吗?','提示',{
                confirmButtonText: '确认',
                cancelButtonText: '取消',
                type: 'warning'
      }).then(()=>{
        let self = this;
        this.$http.deletePath("/api/contests/authorizes/delete/" + row.authorizedId, {}, function(res) {
          if (res.success) {
            self.$message({
              message: "删除成功！",
              type: "success"
            });
          }else{
            self.$message.error(res.data)
          }
          self.innerSearch(1);
        });
      }).catch(()=>{});
    },
    savePush(){
        if(this.multipleSelection.length == 0){
            this.$message.error("请至少选择一项")
            return false;
        }
        var temp = []
        for(var i = 0;i<this.multipleSelection.length;i++){
            temp.push(this.multipleSelection[i].supplierCode)
        }
        let self = this
        this.$http.postObj('/api/contests/authorizes/batchSave/'+this.InnerId,temp,function(res){
            if(res.success){
                self.isShowAddModel = false
                self.innerSearch(1)
                self.$message({
                    message: "添加成功！",
                    type: "success"
                })
            }else{
              self.$message.error(res.data)
            }
        })
    },
    savePrice(){
      var temp = []
      for(var i = 0;i<this.InnerDataTable.length;i++){
        var t = {
          orgCode:this.InnerDataTable[i].authorizedCode,
          price:this.InnerDataTable[i].authorizedPrice,
          storageId:this.InnerDataTable[i].storageId
        }
        temp.push(t)
      }
      var self = this
      this.$http.postObj('/api/contests/authorizes/editPrice/'+this.InnerId,temp,function(res){
        if(res.success){
          self.$message({
            message: "价格保存成功！",
            type: "success"
          })
        }
      })
    }
  },
  components: {
    backHeader
  },
  mounted(){
        this.$nextTick(function () {
            this.tableHeight = window.innerHeight - 320;
            
            // 监听窗口大小变化
            let self = this;
            window.onresize = function() {
                self.tableHeight = window.innerHeight - 320
            }
            this.tableHeight1 = window.innerHeight - 340;
            this.tableHeight3 = window.innerHeight - 360;
            
            // 监听窗口大小变化
            let self1 = this;
            window.onresize = function() {
            this.tableHeight1 = window.innerHeight - 340;
                self1.tableHeight3 = window.innerHeight - 360
            }
        })
  }
};
</script>
<style rel="stylesheet/scss" lang="scss">
.roleControlTable .editor {
    background: none;
    border: none;
    padding: 0;
    color: #0070ed;
    font-size: 14px;
    margin-right:10px;
}
.dee {
  height: 70vh;
  .el-dialog__body{

    height:93%;
    
  }
}
.power.atuo{
  margin-right: 15px !important;
}
.wid150 {
  width: 235px  !important;
  .el-form-item__content{
  width: 150px  !important;
  }
  .el-select{
    width: 150px !important;
  }
}
.witds{
  .el-input{
    .el-input__inner{
      width: 185px;
      padding: 0 30px 0 15px;
    }
  }
}
.amend{
  cursor: pointer;
}
.roleControlTable{
 height: calc(100% - 186px) !important;
 height: -webkit-calc(100% - 186px) !important;
}
.shijian{width: 320px !important;}
.wed{
  width: 110px !important;
}
.wed1{
   width: 210px !important;
}
.backuy{
  width: 28px;
  height: 28px;
  text-align: center;
  line-height: 31px;
  border-radius: 50%;
  border:1px solid #000;
  display: inline-block;
  position: relative;
  top: 7px;
  margin-right: 10px;
  cursor: pointer;
  .el-icon-back{
    font-size: 20px;
  }
}
.addcustom{
  .el-dialog__body{
    padding-top: 3px;
  }
  .el-pagination{
    text-align: center;
  }
  .dialog-footer{
    text-align: center;
    width: 100%;
    display: block;
    .el-button--primary{
      background-color: #5b65a1;
      color:#fff;
      border:none;
    }
  }
} 
.dewd{
  width: auto !important;
}
.add{
  margin-bottom: 5px;
  text-align: right;
  button:last-child{
    margin-right: 0;
  }
  span{
    cursor: pointer;
  }
  .el-button--primary{
    background-color: #5b65a1;
    color:#fff;
    border:none;
        margin-right: 10px;
  }
}
.lampData .lampData_top .el-form-item{
  width: auto !important;
  margin-right: 4px;
  .el-select{
    width: 185px;
  }
  &.atuo{
    width: auto;
    margin-left: 5px;
  }
  &.shijian{
    .el-date-editor.el-input{
      width: 115px;
      &.el-input--suffix .el-input__inner{
        padding-right: 5px;
      }
    }
  }
}
.fdfefcs{
  .el-form-item__label{
    width: 97px !important;
  }
}
.lampData {
  .el-form-item {
    margin-right: 20px;
    .el-button--primary {
      background-color: #5b65a1;
      border-radius: 4px;
      border: none;
    }
  }
  .witd {
    .el-form-item__label {
      // width: 82px;
    }
  }
}
    .top{
        margin-bottom: 20px;
        
    }
    .button{
            background-color: #5b65a1;
            border-radius: 4px;
            color: #fff;
            padding: 12px 20px;
            font-size: 14px;
            border: none;
            margin-right: 20px;
            cursor: pointer;
        }
    </style>